/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.chlitina.store.common.persistence.BaseDao;
import com.chlitina.store.common.persistence.BaseDaoImpl;
import com.chlitina.store.modules.expert.entity.SolutionFaceFood;

/**
 * 方案健康食品DAO接口
 * @author liujiang
 * @version 2014-02-10
 */
public interface SolutionFaceFoodDao extends SolutionFaceFoodDaoCustom, CrudRepository<SolutionFaceFood, Long> {
	@Query("from SolutionFaceFood where SOLUTION_ID = ?1 AND PRODUCT_ID = ?2")
	public SolutionFaceFood findByPKId(Long solutionId, Long productId);
	
	@Query("select distinct f from SolutionFaceFood f, ProductCategoryStoreType t, SolutionFaceFoodLocationSeason l "
			+ " where f.product.productCategory.id = t.productCategory.id and f.product.id = l.product.id and f.product.status = 0 "
			+ " and f.solutionFace.id = ?1 and l.solutionFace.id = ?1 and l.systemDefinitionAreaSeason.id = ?2 and t.storeType.id = ?3")
	public List<SolutionFaceFood> getBySolutionFace(long SolutionFaceId, long locationSeason, long storeTypeId);
}

/**
 * DAO自定义接口
 * @author liujiang
 */
interface SolutionFaceFoodDaoCustom extends BaseDao<SolutionFaceFood> {

}

/**
 * DAO自定义接口实现
 * @author liujiang
 */
@Component
class SolutionFaceFoodDaoImpl extends BaseDaoImpl<SolutionFaceFood> implements SolutionFaceFoodDaoCustom {

}
